package org.rsbot.client.input;

import java.awt.Component;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;

public abstract class Mouse extends Focus
  implements MouseListener, MouseMotionListener, MouseWheelListener
{
  private int clientX;
  private int clientY;
  private int clientPressX = -1;
  private int clientPressY = -1;
  private long clientPressTime = -1L;
  private boolean clientPresent;
  private boolean clientPressed;

  public abstract void _mouseClicked(MouseEvent paramMouseEvent);

  public abstract void _mouseDragged(MouseEvent paramMouseEvent);

  public abstract void _mouseEntered(MouseEvent paramMouseEvent);

  public abstract void _mouseExited(MouseEvent paramMouseEvent);

  public abstract void _mouseMoved(MouseEvent paramMouseEvent);

  public abstract void _mousePressed(MouseEvent paramMouseEvent);

  public abstract void _mouseReleased(MouseEvent paramMouseEvent);

  public abstract void _mouseWheelMoved(MouseWheelEvent paramMouseWheelEvent);

  public abstract Component getComponent();

  public int getX()
  {
    return this.clientX;
  }

  public int getY() {
    return this.clientY;
  }

  public int getPressX() {
    return this.clientPressX;
  }

  public int getPressY() {
    return this.clientPressY;
  }

  public long getPressTime() {
    return this.clientPressTime;
  }

  public boolean isPressed() {
    return this.clientPressed;
  }

  public boolean isPresent() {
    return this.clientPresent;
  }

  public final void mouseClicked(MouseEvent paramMouseEvent) {
    this.clientX = paramMouseEvent.getX();
    this.clientY = paramMouseEvent.getY();
    _mouseClicked(paramMouseEvent);
    paramMouseEvent.consume();
  }

  public final void mouseDragged(MouseEvent paramMouseEvent) {
    this.clientX = paramMouseEvent.getX();
    this.clientY = paramMouseEvent.getY();
    _mouseDragged(paramMouseEvent);
    paramMouseEvent.consume();
  }

  public final void mouseEntered(MouseEvent paramMouseEvent) {
    this.clientPresent = true;
    this.clientX = paramMouseEvent.getX();
    this.clientY = paramMouseEvent.getY();
    _mouseEntered(paramMouseEvent);
    paramMouseEvent.consume();
  }

  public final void mouseExited(MouseEvent paramMouseEvent) {
    this.clientPresent = false;
    this.clientX = paramMouseEvent.getX();
    this.clientY = paramMouseEvent.getY();
    _mouseExited(paramMouseEvent);
    paramMouseEvent.consume();
  }

  public final void mouseMoved(MouseEvent paramMouseEvent) {
    this.clientX = paramMouseEvent.getX();
    this.clientY = paramMouseEvent.getY();
    _mouseMoved(paramMouseEvent);
    paramMouseEvent.consume();
  }

  public final void mousePressed(MouseEvent paramMouseEvent) {
    this.clientPressed = true;
    this.clientX = paramMouseEvent.getX();
    this.clientY = paramMouseEvent.getY();
    _mousePressed(paramMouseEvent);
    paramMouseEvent.consume();
  }

  public final void mouseReleased(MouseEvent paramMouseEvent) {
    this.clientX = paramMouseEvent.getX();
    this.clientY = paramMouseEvent.getY();
    this.clientPressX = paramMouseEvent.getX();
    this.clientPressY = paramMouseEvent.getY();
    this.clientPressTime = System.currentTimeMillis();
    this.clientPressed = false;

    _mouseReleased(paramMouseEvent);
    paramMouseEvent.consume();
  }

  public void mouseWheelMoved(MouseWheelEvent paramMouseWheelEvent) {
    try {
      _mouseWheelMoved(paramMouseWheelEvent);
    }
    catch (AbstractMethodError localAbstractMethodError) {
    }
    paramMouseWheelEvent.consume();
  }

  public final void sendEvent(MouseEvent paramMouseEvent) {
    this.clientX = paramMouseEvent.getX();
    this.clientY = paramMouseEvent.getY();
    try {
      if (paramMouseEvent.getID() == 500) {
        _mouseClicked(paramMouseEvent);
      } else if (paramMouseEvent.getID() == 506) {
        _mouseDragged(paramMouseEvent);
      } else if (paramMouseEvent.getID() == 504) {
        this.clientPresent = true;
        _mouseEntered(paramMouseEvent);
      } else if (paramMouseEvent.getID() == 505) {
        this.clientPresent = false;
        _mouseExited(paramMouseEvent);
      } else if (paramMouseEvent.getID() == 503) {
        _mouseMoved(paramMouseEvent);
      } else if (paramMouseEvent.getID() == 501) {
        this.clientPressed = true;
        _mousePressed(paramMouseEvent);
      } else if (paramMouseEvent.getID() == 502) {
        this.clientPressX = paramMouseEvent.getX();
        this.clientPressY = paramMouseEvent.getY();
        this.clientPressTime = System.currentTimeMillis();
        this.clientPressed = false;
        _mouseReleased(paramMouseEvent);
      } else if (paramMouseEvent.getID() == 507) {
        try {
          _mouseWheelMoved((MouseWheelEvent)paramMouseEvent);
        } catch (AbstractMethodError localAbstractMethodError) {
        }
      }
      else {
        throw new InternalError(paramMouseEvent.toString());
      }
    }
    catch (NullPointerException localNullPointerException)
    {
    }
  }
}